import { _decorator, Component, Node, Prefab } from 'cc';
import { instantiate } from 'cc';
import { BaseView } from '../../../../scripts/libs/rxjs/cc3/BaseView';
import { Colors } from '../../game/basic';
import { ColorEditorButton } from './ColorEditorButton';
const { ccclass, property } = _decorator;

@ccclass('EditorTools3')
export class EditorTools3 extends BaseView {

    @property(Prefab)
    ColorEditorButtonPrefab: Prefab = null;

    @property(Node)
    colorContentNode: Node = null;

    willBind(): void {
        this.colorContentNode.destroyAllChildren();
        for (let colorId in Colors) {
            let node = instantiate(this.ColorEditorButtonPrefab);
            node.getComponent(ColorEditorButton).colorId = Number(colorId);
            this.colorContentNode.addChild(node);
        }
    }

}


